#
# @lc app=leetcode.cn id=26 lang=python3
#
# [26] 删除有序数组中的重复项
#

# @lc code=start
from typing import List


class Solution:
    def removeDuplicates(self, nums: List[int]) -> int:
        if len(nums) <= 1:
            return len(nums)
        new = 0
        for i in range(1, len(nums)):
            if nums[new] < nums[i]:
                new += 1
                nums[new] = nums[i]
        return new + 1


# @lc code=end
